package cn.yto.print.plugins;

import cn.yto.print.constants.AssistantConstants;
import cn.yto.print.enums.PluginRegistryEnum;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class PluginInstalledManager {

    private static final PluginInstalledManager INSTANCE = new PluginInstalledManager();
    private final Map<String, Integer> installMap = new ConcurrentHashMap<>();

    private PluginInstalledManager() {
        installMap.put(PluginRegistryEnum.CN.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.DY.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.WPH.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.PDD.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.DW.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.JD.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.XHSX.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.KS.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.WXSPH.getCode(), AssistantConstants.UNKNOWN);
        installMap.put(PluginRegistryEnum.AKC.getCode(), AssistantConstants.UNKNOWN);
    }

    public static PluginInstalledManager getInstance() {
        return INSTANCE;
    }

    public void updateInstallStatus(String code, Integer connected) {
        installMap.put(code, connected);
    }

    public Integer getInstallStatus(String code) {
        return installMap.get(code);
    }

}
